import 'libs/promise.finally'

it('should call finally when resolving promise', done => {
  const finallyMock = jest.fn()

  Promise.resolve(1).finally(() => {
    finallyMock()
    expect(finallyMock).toBeCalled()

    done()
  })
})

it('should call finally when rejecting promise', done => {
  const finallyMock = jest.fn()

  Promise.reject(1)
    .finally(() => {
      finallyMock()
      expect(finallyMock).toBeCalled()

      done()
    })
    .catch(() => {})
})
